
<%@ page language="java" pageEncoding="UTF-8"	contentType="text/html; charset=UTF-8"%>
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="${ctx}/js/jquery-easyui-1.4.1/themes/icon.css" type="text/css"></link>
<link rel="stylesheet" href="${ctx}/css/default.css"  type="text/css" />
<script type="text/javascript" src="${ctx}/js/jquery-3.0.0.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="${ctx}/js/jquery-easyui-1.4.1/jquery.easyui.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="${ctx}/js/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js" charset="UTF-8"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/ueditor.all.min.js"></script>
<script language="javascript" src="${ctx}/js/LodopFuncs.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/js/uploadPreview.js" charset="utf-8"></script>

<% String name = null;
	if(application.getAttribute("themeName")!=null&&application.getAttribute("themeName")!=""){
	name = application.getAttribute("themeName").toString();
	}else{
	name = "default";
	}
 %>
<link id="uiTheme" rel="stylesheet" href="${ctx}/js/jquery-easyui-1.4.1/themes/<%=name %>/easyui.css" type="text/css"></link>
<script type="text/javascript" charset="UTF-8">
window.UEDITOR_HOME_URL = "${ctx}/ueditor/";
//屏蔽右键
document.oncontextmenu=function(e){return true;}
//屏蔽状态栏
window.status='欢迎使用！';

//ValidateBox 验证扩展
$.extend($.fn.validatebox.defaults.rules, { 
//判断两个值相等  
    equals: {   
        validator: function(value,param){   
            return value == $(param[0]).val();   
        },   
        message: '前后密码不一致'
    },   

//判断最小长度  
    minLength: {   
        validator: function(value, param){   
            return value.length >= param[0];   
        },   
        message: '请输入至少 {0} 个字符'  
    }, 
    
//判断最大长度  
    maxLength: {   
        validator: function(value, param){   
            return value.length <= param[0];   
            
        },   
        message: '输入最多 {0} 个字符'  
    },  

  //判断最大长度  
    maxLengthValid: {   
        validator: function(value, param){   
            return value.length <= param[0];   
        },   
        message: '{1}'  
    }, 

//正则表达式 判断汉字   
    chinese: {   
        validator: function(value){ 
        	var reg=/^[\u4e00-\u9faf]+$/; 
            return reg.test(value);   
        },   
        message: '请输入汉字'  
    },  
//正则表达式判断文件类型xls
	xls:{
		validator: function(value){ 
        	var reg=/\.xls$/; 
            return reg.test(value);   
        },   
        message: '请选择后缀名 xls 的文件'
	}
});
//ValidateBox方法扩展，移除验证、还原验证
$.extend($.fn.validatebox.methods, { 
    remove: function(jq, newposition){ 
        return jq.each(function(){ 
            $(this).removeClass("validatebox-text validatebox-invalid").unbind('focus.validatebox').unbind('blur.validatebox');
        }); 
    },
    reduce: function(jq, newposition){ 
        return jq.each(function(){ 
           var opt = $(this).data().validatebox.options;
           $(this).addClass("validatebox-text").validatebox(opt);
        }); 
    }  
});
$.extend($.fn.validatebox.defaults.rules,{
   TimeCheck:{
    validator:function(value,param){     
     var s = $(param[0]).datebox('getValue');
     //因为日期是统一格式的所以可以直接比较字符串 否则需要Date.parse(_date)转换
     return value>=s;
    },
    message:'非法数据'
   }
});
	/** 
     * 扩展树表格级联勾选方法： 
     * @param {Object} container 
     * @param {Object} options 
     * @return {TypeName}  
     */  
    $.extend($.fn.treegrid.methods,{  
        /** 
         * 级联选择 
         * @param {Object} target 
         * @param {Object} param  
         *      param包括两个参数: 
         *          id:勾选的节点ID 
         *          deepCascade:是否深度级联 
         * @return {TypeName}  
         */  
        cascadeCheck : function(target,param){
            var opts = $.data(target[0], "treegrid").options;  
            if(opts.singleSelect)  
                return;  
            var idField = opts.idField;//这里的idField其实就是API里方法的id参数  
            var status = false;//用来标记当前节点的状态，true:勾选，false:未勾选  
            var selectNodes = $(target).treegrid('getSelections');//获取当前选中项 
            for(var i=0;i<selectNodes.length;i++){  
                if(selectNodes[i][idField]==param.id)  
                    status = true;  
            }
            //级联选择父节点
            if(status){
            	selectParent(target[0],param.id,idField,status);
            }
            //选择子节点
            selectChildren(target[0],param.id,idField,param.deepCascade,status);  
            /** 
             * 级联选择父节点 
             * @param {Object} target 
             * @param {Object} id 节点ID 
             * @param {Object} status 节点状态，true:勾选，false:未勾选 
             * @return {TypeName}  
             */  
            function selectParent(target,id,idField,status){  
                var parent = $(target).treegrid('getParent',id);  
                if(parent){  
                    var parentId = parent[idField];  
                    if(status)  
                        $(target).treegrid('select',parentId);  
                    else  
                        $(target).treegrid('unselect',parentId);  
                    selectParent(target,parentId,idField,status);  
                }  
            }  
            /** 
             * 级联选择子节点 
             * @param {Object} target 
             * @param {Object} id 节点ID 
             * @param {Object} deepCascade 是否深度级联 
             * @param {Object} status 节点状态，true:勾选，false:未勾选 
             * @return {TypeName}  
             */  
            function selectChildren(target,id,idField,deepCascade,status){  
                //深度级联时先展开节点  
                if(!status&&deepCascade)  
                    $(target).treegrid('expand',id);  
                //根据ID获取下层孩子节点  
                var children = $(target).treegrid('getChildren',id);  
                for(var i=0;i<children.length;i++){  
                    var childId = children[i][idField];
                    if(status)  
                        $(target).treegrid('select',childId);  
                    else  
                        $(target).treegrid('unselect',childId);  
                    selectChildren(target,childId,idField,deepCascade,status);//递归选择子节点 
                }  
            }
        }
    });
    /** 
     * 扩展树表格级联选择（点击checkbox才生效）： 
     *      自定义两个属性： 
     *      cascadeCheck ：普通级联（不包括未加载的子节点） 
     *      deepCascadeCheck ：深度级联（包括未加载的子节点） 
     */  
    $.extend($.fn.treegrid.defaults,{  
        onLoadSuccess : function() {
            var target = $(this);  
            var opts = $.data(this, "treegrid").options;  
            var panel = $(this).datagrid("getPanel");  
            var gridBody = panel.find("div.datagrid-body");  
            var idField = opts.idField;//这里的idField其实就是API里方法的id参数  
            gridBody.find("div.datagrid-cell-check input[type=checkbox]").unbind(".treegrid").click(function(e){  
                if(opts.singleSelect) return;//单选不管  
                if(opts.cascadeCheck||opts.deepCascadeCheck){  
                    var id=$(this).parent().parent().parent().attr("node-id");  
                    var status = false;  
                    if($(this).attr("checked")) status = true;  
                    //级联选择父节点  
                    selectParent(target,id,idField,status);  
                    selectChildren(target,id,idField,opts.deepCascadeCheck,status);  
                    /** 
                     * 级联选择父节点 
                     * @param {Object} target 
                     * @param {Object} id 节点ID 
                     * @param {Object} status 节点状态，true:勾选，false:未勾选 
                     * @return {TypeName}  
                     */  
                    function selectParent(target,id,idField,status){  
                        var parent = target.treegrid('getParent',id);  
                        if(parent){  
                            var parentId = parent[idField];  
                            if(status)  
                                target.treegrid('select',parentId);  
                            else  
                                target.treegrid('unselect',parentId);  
                            selectParent(target,parentId,idField,status);  
                        }  
                    }  
                    /** 
                     * 级联选择子节点 
                     * @param {Object} target 
                     * @param {Object} id 节点ID 
                     * @param {Object} deepCascade 是否深度级联 
                     * @param {Object} status 节点状态，true:勾选，false:未勾选 
                     * @return {TypeName}  
                     */  
                    function selectChildren(target,id,idField,deepCascade,status){  
                        //深度级联时先展开节点  
                        if(status&&deepCascade)  
                            target.treegrid('expand',id);  
                        //根据ID获取下层孩子节点  
                        var children = target.treegrid('getChildren',id);  
                        for(var i=0;i<children.length;i++){  
                            var childId = children[i][idField];  
                            if(status)  
                                target.treegrid('select',childId);  
                            else  
                                target.treegrid('unselect',childId);  
                            selectChildren(target,childId,idField,deepCascade,status);//递归选择子节点  
                        }  
                    }  
                }  
                e.stopPropagation();//停止事件传播  
            });  
        }  
    });
//重置DataGrid 第一页
function resetDG(dg){
 	$(dg).datagrid('options').pageNumber = 1;
    	var p = $(dg).datagrid('getPager');
    	if (p){
			$(p).pagination({
				pageNumber:1
			});
    	}
    	$(dg).datagrid('reload');
}

$(function(){
	
})

function myformatter(date){
	var y = date.getFullYear();
	var m = date.getMonth()+1;
	var d = date.getDate();
	return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
function formatterYearAdnMonth(date){
	var y = date.getFullYear();
	var m = date.getMonth()+1;
	var d = date.getDate();
	return y+'-'+(m<10?('0'+m):m);
}
function myparser(s){
	if (!s) return new Date();
	var ss = s.split('-');
	var y = parseInt(ss[0],10);
	var m = parseInt(ss[1],10);
	var d = parseInt(ss[2],10);
	if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
		return new Date(y,m-1,d);
	} else {
		return new Date();
	}
}
function myformatter1(date){
	var y = date.getFullYear();
	var m = date.getMonth()+1;
	var d = date.getDate();
	var h = date.getHours();
	var mi = date.getMinutes();
	return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d)+' '+(h<10?('0'+h):h)+':'+(mi<10?('0'+mi):mi);
}
//显示加载等待样式
	function jzdd(msg) {
		$("<div class=\"datagrid-mask\"></div>").css({display : "block",width : "100%",height : $(window).height()}).appendTo("body");
		$("<div class=\"datagrid-mask-msg\"></div>").html(msg+"......").appendTo("body").css({display : "block",left : ($(document.body).outerWidth(true) - 190) / 2,top : ($(window).height() - 45) / 2});
	}
//关闭加载等待样式
	function ddgb() {
		$("body").find("div.datagrid-mask-msg").remove()
		$("body").find("div.datagrid-mask").remove();
	}
//求两个时间的天数差 日期格式为 YYYY-MM-dd	
function getDays(strDateStart,strDateEnd){
   var strSeparator = "-"; //日期分隔符
   var oDate1;
   var oDate2;
   var iDays;
   oDate1= strDateStart.split(strSeparator);
   oDate2= strDateEnd.split(strSeparator);
   var strDateS = new Date(oDate1[0] + "-" + oDate1[1] + "-" + oDate1[2]);
   var strDateE = new Date(oDate2[0] + "-" + oDate2[1] + "-" + oDate2[2]);
   iDays = parseInt(Math.abs(strDateS - strDateE ) / 1000 / 60 / 60 /24)//把相差的毫秒数转换为天数 

   return iDays ;
}
//js代码休眠，参数为‘秒’
	function sleep(mi) {
		var exitTime = new Date().getTime() + mi*1000;
		while (true) {
			if (new Date().getTime() > exitTime){
				return;
			}
				
		}
	}
	
	
	/*============================================================================分割线 jsp调用的方法===========================================================================================*/
	
	
	//校验手机号码：必须以数字开头
	function isMobile(s) 
	{
	    var patrn=/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
	    if(!patrn.exec(s))
	    {
	        return false;
	    }
	    return true;
	} 
	
	//检验身份证
	function isIdCard(s) 
	{
	    var patrn = /^\s*\d{15}\s*$/;
	    var patrn1 = /^\s*\d{16}[\dxX]{2}\s*$/;
	    if(!patrn.exec(s) && !patrn1.exec(s))
	    {
	        return false;
	    }
	    return true;
	} 
	//检验是否为空，是否有空格
	function space(s){
	 var regu = "^[ ]+$";
     var re = new RegExp(regu);
     if(s==""||re.test(s))
     {
   return false;
		 }
  return true;
	}
	function formatStatus(val,row){
		  if (val == 1){
				return '启用';
			}else if (val == 0){
				return '禁用';
			} else {
				return '';
			}
	}
	
	function formatSex(val,row){
		  if (val == 1){
				return '男';
			}else if (val == 2){
				return '女';
			} else {
				return '';
			}
	}
	
	//员工履历有1,无2
	function formatPeriodStatus(val,row){
		  if (val == 1){
				return '有';
			}else if (val == 2){
				return '无';
			} else {
				return '';
			}
	}
	
	function tooltip_right(div_id,info){
	    $(div_id).tooltip({   
		 position: 'right',  
		 content: '<span style="color:#000">'+info+'</span>',  
		 onShow: function(){ 
		        $(this).tooltip('tip').css({   
		         backgroundColor: '#ffffcd',
		         borderColor: '#cc962c'       
          });  
        }});
	
	}
	function tooltip_position(posi,div,info){
	    $(div).tooltip({   
		 position: posi,  
		 content: '<span style="color:#000">'+info+'</span>',  
		 onShow: function(){ 
		        $(this).tooltip('tip').css({   
		         backgroundColor: '#ffffcd',
		         borderColor: '#cc962c'       
          });  
        }});
	
	}
	
	
	
	
	
</script>

